{extend name="public/base" /}
{block name='content'}
{include file='public/content_header' /}
<!--数据列表页面-->
<section class="content">

    <!--顶部搜索筛选-->
<div class="row">
    <div class="col-md-12">
        <div class="card">
            <div class="card-header dataSearch">
                <form class="form-inline searchForm" id="searchForm" action="{:url('index')}" method="GET">

                    <div class="input-group input-group-sm searchGroup">
                        <input value="{$_keywords ? $_keywords : '' ;}"
                               name="_keywords" id="_keywords" class="form-control input-sm" placeholder="">
                    </div>
                    <div class="input-group input-group-sm searchGroup smallSelect">
    <select name="user_id" id="user_id" class="form-control input-sm index-search">
        <option value="">用户</option>
        {foreach name='user_list' id='item'}
        <option value="{$item.id}" {if isset($user_id) && ''!==$user_id && $user_id==$item.id}selected{/if}>{$item.nickname}</option>
        {/foreach}
    </select>
</div>
<script>
    $(function () {
        $('#user_id').select2({
        width:'100%'
        });
    });
</script>
<div class="input-group input-group-sm searchGroup smallSelect">
    <select name="type_id" id="type_id" class="form-control input-sm index-search">
        <option value="">分类</option>
        {foreach name='type_list' id='item'}
        <option value="{$item.id}" {if isset($type_id) && ''!==$type_id && $type_id==$item.id}selected{/if}>{$item.name}</option>
        {/foreach}
    </select>
</div>
<script>
    $(function () {
        $('#type_id').select2({
        width:'100%'
        });
    });
</script>
<div class="input-group input-group-sm searchGroup smallSelect">
    <select name="parent_id" id="parent_id" class="form-control input-sm index-search">
        <option value="">大分类</option>
        {foreach name='parent_list' id='item'}
        <option value="{$item.id}" {if isset($parent_id) && ''!==$parent_id && $parent_id==$item.id}selected{/if}>{$item.name}</option>
        {/foreach}
    </select>
</div>
<script>
    $(function () {
        $('#parent_id').select2({
        width:'100%'
        });
    });
</script>

                    <div class="form-group smallSelect">
    <select name="_order" id="_order" class="form-control input-sm index-order">
        <option value="">排序字段</option>
        <option value="id" {if isset($_order) && $_order=='id'}selected{/if}>ID</option><option value="money" {if isset($_order) && $_order=='money'}selected{/if}>报价</option><option value="create_time" {if isset($_order) && $_order=='create_time'}selected{/if}>添加时间</option>
    </select>
</div>

<div class="form-group smallSelect">
    <select name="_by" id="_by" class="form-control input-sm index-order">
        <option value="">排序方式</option>
        <option value="desc" {if isset($_by) && $_by=='desc'}selected{/if}>倒序</option>
        <option value="asc" {if isset($_by) && $_by=='asc'}selected{/if}>正序</option>
    </select>
</div>
<script>
    $('#_order').select2();
    $('#_by').select2();
</script>

                    <div class="form-group searchGroup">
                        <button class="btn btn-sm btn-primary" type="submit"><i class="fa fa-search"></i> 查询
                        </button>
                    </div>
                    
                    <div class="form-group searchGroup">
                        <button onclick="clearSearchForm()" class="btn btn-sm btn-default" type="button"><i
                                class="fa  fa-eraser"></i> 清空查询
                        </button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

    

    <div class="row">
        <div class="col-md-12">
            <div class="card">

                <!--数据列表顶部-->
                <div class="card-header">
                    <div>
                        
                        
                        
                        
                    </div>
                </div>

                <div class="card-body table-responsive p-0" >
                    <table class="table table-hover table-bordered dataTable text-nowrap">
                        <thead>
                        <tr>
                            
                                        <th>ID</th>
            <th>用户</th>
            <th>分类</th>
            <th>大分类</th>
            <th>数量</th>
            <th>规格</th>
            <th>单位</th>
            <th>最高报价</th>
            <th>报价</th>
            <th>添加时间</th>

                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        {foreach name='data' id='item' key='data_key'}
                        <tr>
                            
                                        <td>{$item.id}</td>
            <td>{$item.user.nickname|default=''}</td>
            <td>{$item.type.name|default=''}</td>
            <td>{$item.parent.name|default=''}</td>
            <td>{$item.num}</td>
            <td>{$item.spec.name|default=''}</td>
            <td>{$item.brand.name|default=''}</td>
            <td>{$item.price}</td>
            <td>{$item.money}</td>
            <td>{$item.create_time}</td>

                            <td class="td-do">
                                <a href="{:url('edit',['id'=>$item.id])}"
                                   class="btn btn-primary btn-xs" title="修改" data-toggle="tooltip">
                                    <i class="fas fa-pen"></i>
                                    
                                </a>
                                
                                
                            </td>
                        </tr>
                        {/foreach}
                        </tbody>
                    </table>
                </div>

                <!-- 数据列表底部 -->
                <div class="card-footer">
                    {$page|raw}
                    {include file='public/change_page' /}
                </div>

            </div>
        </div>
    </div>
</section>
{/block}
